package ace.module.stock.sdk.core.feign.impl;

import ace.cmp.core.model.R;
import ace.cmp.openfeign.security.oauth2.core.config.FeignInternalServerOauth2SecurityConfig;
import ace.module.common.api.annotation.ApiRemoteProxyPriority;
import ace.module.common.api.model.input.TenantAndAppTypeInput;
import ace.module.stock.api.model.dto.WmsSalesQuantityDto;
import ace.module.stock.api.model.input.WmsBizInitInput;
import ace.module.stock.api.model.input.WmsBizParentIdInput;
import ace.module.stock.api.model.input.WmsBizUniqueIdInput;
import ace.module.stock.sdk.core.constant.SdkConstant;
import ace.module.stock.sdk.core.feign.WmsSalesQuantityFeignApi;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 销售数量 rpc feign.
 *
 * @author Caspar
 */
@FeignClient(
    name = "${spring.cloud.openfeign.client.config.wmsSalesQuantityFeign.name:" + SdkConstant.FEIGN_SERVICE_NAME + "}",
    contextId = "wmsSalesQuantityFeign",
    path = WmsSalesQuantityFeign.PATH,
    configuration = FeignInternalServerOauth2SecurityConfig.class,
    primary = false
)
@ApiRemoteProxyPriority
public interface WmsSalesQuantityFeign extends WmsSalesQuantityFeignApi {

  String PATH = "${spring.cloud.openfeign.client.config.wmsSalesQuantityFeign.path:/stock/wms-sales-quantity/rpc}";

  @Operation(description = "销量不存在初始化,存在则不操作")
  @PostMapping("/initOrNone")
  R<Void> initOrNone(@Valid @NotNull @RequestBody TenantAndAppTypeInput<List<WmsBizInitInput>> input);

  @Operation(description = "获取相关销量,根据业务id")
  @PostMapping("/getByBizUniqueIdIn")
  R<List<WmsSalesQuantityDto>> getByBizUniqueIdIn(@Valid @NotNull @RequestBody TenantAndAppTypeInput<List<WmsBizUniqueIdInput>> bizUniqueIds);

  @Operation(description = "获取相关销量,根据业务父id")
  @PostMapping("/getByBizParentIdIn")
  R<List<WmsSalesQuantityDto>> getByBizParentIdIn(@Valid @NotNull @RequestBody TenantAndAppTypeInput<WmsBizParentIdInput> bizParentId);
}